package descentFly.away3D4
{
	import UIUtils.uif_JSONLoader;
	
	import away3d.events.LoaderEvent;
	import away3d.vf.managers.awayLoadSection;
	
	import descentFly.app.df_component;
	import descentFly.server.df_servers;
	
	import flash.display.Bitmap;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLRequest;
	import flash.text.TextFormatAlign;
	
	public class df_loadSection extends awayLoadSection {
		public function df_loadSection() {
			super();
		}
		
		override protected function get dataHost():String {
			return df_servers.DATA_URL;
		}
		
		public function addJSONLoader(jsonFilePath: String): uif_JSONLoader {
			var loader: uif_JSONLoader = new uif_JSONLoader();
			addLoaderA(loader, Event.COMPLETE);
			loader.load(new URLRequest(dataHost + jsonFilePath));
			return loader;
		}
		
		public static function loadJSONData(jsonFilePath: Array, result: Function): void {
			var ld		: df_loadSection = new df_loadSection();
			var resArr	: Array = new Array();
			for (var i:int=0; i<jsonFilePath.length; i++) {
				resArr[i] = ld.addJSONLoader(jsonFilePath[i]);
			}
			ld.endSection(function(): void {
				result(resArr);
			});
		}
	}
}